**********
**********
**********
*This is the do-file the analysis for the Singh and Swanson climate change experiment.
**********
**********
**********


**********
*do treatments predict correctly answering filter question?
**********
gen correct = 0
replace correct = 1 if filter == 4
replace correct = . if filter == .
reg correct i.treatment
drop correct



**********
*How many respondents in each group?
**********
tabstat importance_climate, by(treatment) stat(count) labelwidth(45)

tabstat importance_climate if filter == 4, by(treatment) stat(count) labelwidth(45)




**********
*Create table of summary statistics
**********
sum importance_climate rank_climate income female education_level age ideology  b1.party_id if filter == 4

*do it again with b3.party_id to see Dems
sum importance_climate rank_climate income female education_level age ideology  b3.party_id if filter == 4


**********
*do background characteristics jointly predict treatment?
**********
*This check is based on that of Levendusky, Matthew S., and Michael C. Horowitz. 2012. "When Backing Down Is the Right Decision: Partisanship, New Information, and Audience Costs." Journal of Politics 74 (2): 323-38 (pages 328-329). 
 			
mlogit treatment income female education_level ideology age i.party_id 

*can use the method below to verify the the effects of the covariates are simultaneously equal to zero
mlogit treatment income female education_level ideology age i.party_id 
estimates store fullmodel  
			
mlogit treatment if e(sample)
estimates store emptymodel  			

lrtest fullmodel emptymodel	



**********
**********
*DEPENDENT VARIABLE IS IMPORTANCE OF ENVIRONMENT
**********
**********


**********
*FIGURE 1: importance of environment over treatment
**********
reg  importance_climate i.treatment if filter == 4

*graphical depiction 
margins, dydx(treatment) level(90)
marginsplot, ///	
			recast(scatter) recastci(rspike) ytitle("") xtitle("Effect of Frame on Rating of Importance of Climate Change Policy", size(small)) title("") /// 
			plot1opts(color(red))  ///
			ci1opts(lcolor(red*.55) lpattern(solid)) ///
			xline(0, lpattern(dash))  horizontal scheme(s1color)  ///
			aspect(.3)   ///
			ylabel( 2 	"Environmental Frame, With Source"  ///
					3	"Environmental Frame, No Source" ///
					4	"Human Rights Frame, With Source"  ///
					5	"Human Rights Frame, No Source" ///
					6	"Security Frame, With Source" ///
					7	"Security Frame, No Source" , nogrid labsize(vsmall)) 


**********
*importance of environment over Frame, by party ID
**********
reg  importance_climate i.treatment##i.party_id if filter == 4

*graphical depiction
margins, dydx(treatment) over(party_id) level(90)
marginsplot, ///	
			recast(scatter) recastci(rspike) ytitle("") xtitle("Effect of Frame on Rating of Importance of Climate Change Policy, by Party ID", size(vsmall)) title("") /// 
			plot1opts(color(red))  ///
			ci1opts(lcolor(red*.55) lpattern(solid)) ///
			xline(0, lpattern(dash))  horizontal scheme(s1color)  ///
			aspect(.3) bydimension(party_id, ) byopt(title("")  rows(3) ) subtitle(, fcolor(red*.5) size(small)) ///
			ylabel( 2 	"Environmental Frame, With Source"  ///
					3	"Environmental Frame, No Source" ///
					4	"Human Rights Frame, With Source"  ///
					5	"Human Rights Frame, No Source" ///
					6	"Security Frame, With Source" ///
					7	"Security Frame, No Source" , nogrid labsize(vsmall)) ///
			name(int_party_id_rating, replace) 

		
			
**********
*importance of environment over Frame, by ideology
**********
reg  importance_climate i.treatment##c.ideology if filter == 4

*graphical depiction
margins, dydx(treatment)  at(ideology = (0 5 10)) level(90)
marginsplot, ///	
			recast(scatter) recastci(rspike) ytitle("") xtitle("Effect of Frame on Rating of Importance of Climate Change Policy, by Ideology", size(vsmall)) title("") /// 
			plot1opts(color(red))  ///
			ci1opts(lcolor(red*.55) lpattern(solid)) ///
			xline(0, lpattern(dash))  horizontal scheme(s1color)  ///
			aspect(.3) bydimension(ideology, ) byopt(title("")  rows(3) ) subtitle(, fcolor(red*.5) size(small)) ///
			ylabel( 2 	"Environmental Frame, With Source"  ///
					3	"Environmental Frame, No Source" ///
					4	"Human Rights Frame, With Source"  ///
					5	"Human Rights Frame, No Source" ///
					6	"Security Frame, With Source" ///
					7	"Security Frame, No Source" , nogrid labsize(vsmall)) ///
			name(int_ideology_rating, replace) 


			
	 

**********
**********
*FIGURE 2: COMBINE GRAPHS
**********
**********

graph combine  ///
	int_ideology_rating ///
	int_party_id_rating ///
	, rows(1) xsize(6.5) iscale(.95) scale(1) xcommon ycommon graphregion(margin(zero)) scheme(s1color) 

			
			

**********
**********
*DEPENDENT VARIABLE IS RANK OF CLIMATE IMPORTANCE
**********
**********

**********
*FIGURE 3: importance of environment over treatment
**********
reg  rank_climate_rev i.treatment if filter == 4
*are the effects of the treatments with and without sources statistically different?
listcoef
test 2.treatment = 3.treatment
test 4.treatment = 5.treatment
test 6.treatment = 7.treatment

*graphical depiction 
margins, dydx(treatment) 
marginsplot, ///	
			recast(scatter) recastci(rspike) ytitle("") xtitle("Effect of Frame on Ranking of Importance of Climate Change Policy", size(small)) title("") /// 
			plot1opts(color(red))  ///
			ci1opts(lcolor(red*.55) lpattern(solid)) ///
			xline(0, lpattern(dash))  horizontal scheme(s1color)  ///
			aspect(.3) ///
			ylabel( 2 	"Environmental Frame, With Source"  ///
					3	"Environmental Frame, No Source" ///
					4	"Human Rights Frame, With Source"  ///
					5	"Human Rights Frame, No Source" ///
					6	"Security Frame, With Source" ///
					7	"Security Frame, No Source" , nogrid labsize(vsmall)) 

			

**********
*importance of environment over Frame, by party ID
**********
reg  rank_climate_rev i.treatment##i.party_id if filter == 4

*graphical depiction
margins, dydx(treatment) over(party_id) level(90)
marginsplot, ///	
			recast(scatter) recastci(rspike) ytitle("") xtitle("Effect of Frame on Ranking of Importance of Climate Change Policy, by Party ID", size(vsmall)) title("") /// 
			plot1opts(color(red))  ///
			ci1opts(lcolor(red*.55) lpattern(solid)) ///
			xline(0, lpattern(dash))  horizontal scheme(s1color)  ///
			aspect(.3) bydimension(party_id, ) byopt(title("")  rows(3) ) subtitle(, fcolor(red*.5) size(small)) ///
			ylabel( 2 	"Environmental Frame, With Source"  ///
					3	"Environmental Frame, No Source" ///
					4	"Human Rights Frame, With Source"  ///
					5	"Human Rights Frame, No Source" ///
					6	"Security Frame, With Source" ///
					7	"Security Frame, No Source" , nogrid labsize(vsmall)) ///
			name(int_party_id_ranking, replace) 


		
			
**********
*importance of environment over Frame, by ideology
**********
reg  rank_climate_rev i.treatment##c.ideology if filter == 4

*graphical depiction
margins, dydx(treatment)  at(ideology = (0 5 10)) level(90)
marginsplot, ///	
			recast(scatter) recastci(rspike) ytitle("") xtitle("Effect of Frame on Ranking of Importance of Climate Change Policy, by Ideology", size(vsmall)) title("") /// 
			plot1opts(color(red))  ///
			ci1opts(lcolor(red*.55) lpattern(solid)) ///
			xline(0, lpattern(dash))  horizontal scheme(s1color)  ///
			aspect(.3) bydimension(ideology, ) byopt(title("")  rows(3) ) subtitle(, fcolor(red*.5) size(small)) ///
			ylabel( 2 	"Environmental Frame, With Source"  ///
					3	"Environmental Frame, No Source" ///
					4	"Human Rights Frame, With Source"  ///
					5	"Human Rights Frame, No Source" ///
					6	"Security Frame, With Source" ///
					7	"Security Frame, No Source" , nogrid labsize(vsmall)) ///
			name(int_ideology_ranking, replace) 

			
			
**********
**********
*FIGURE 4: COMBINE GRAPHS
**********
**********

graph combine  ///
	"/Users/singh/Google Drive/PLS/Research/With Meili/Framing and Climate Change/figures/int_ideology_ranking.gph" ///
	"/Users/singh/Google Drive/PLS/Research/With Meili/Framing and Climate Change/figures/int_party_id_ranking.gph" ///
	, rows(1) xsize(6.5) iscale(.95) scale(1) xcommon ycommon graphregion(margin(zero)) scheme(s1color) 
	
			

			


			
